﻿<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" autoFlush="true"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<span class="title1">个人信息</span>
<table class="qlist" width="100%" align="center" cellpadding="0" cellspacing="0" style="background-color:#FAFCFC;border:1px solid #ccc;">
    <html:form action="/user" method="post" onsubmit="return validate(this);" focus="loginName">
    <html:hidden property="action" value="changeuserprofile"/>
    <input type="hidden" name="id" value="<c:out value="${user_session.userId}"/>"/>
    <tr>
        <td align="right">登录名</td>
        <td>
            <c:out value="${usero.loginName}"/>
            <html:hidden property="loginName" name="usero"/>
        </td>
    </tr>
    <tr>
        <td align="right">密码提示</td>
        <td>
            <html:text property="passwordQuestion" name="usero" size="12" maxlength="12" style="width:120px;border:1px solid #7F9DB9;margin:0 0 0 0px;"/>*(密码提示，可以帮助找回密码。如：我的单位)
        </td>
    </tr> 
    <tr>
        <td align="right">密码答案</td>
        <td>
            <html:text property="passwordAnswer" name="usero" size="12" maxlength="12" style="width:120px;border:1px solid #7F9DB9;margin:0 0 0 0px;"/>*(如：花旗。找回密码的时候根据系统提示的【密码答案】输入【密码答案】，可以找回密码)
        </td>
    </tr> 
    <tr>
        <td align="right">名称</td>
        <td>
            <html:text property="name" size="20" maxlength="20" name="usero"/>
        </td>
    </tr> 
    <tr>
        <td align="right">电子邮件</td>
        <td>
            <html:text property="email" size="50" maxlength="50" name="usero"/>*&nbsp;&nbsp;<html:checkbox property="isEmailPublic" name="usero"/>是否公开&nbsp;&nbsp;&nbsp;&nbsp;<html:link page="/user.mrqa?action=checkemailexist" target="checkemailexist" onclick="return checkEmailExit(this);">检查电子邮件是否占用</html:link>
            <iframe src="" name="checkemailexist" height="1" scrolling="no" frameborder="0" width="1"></iframe>
            <br>
            (【电子邮件】地址必须唯一；要保证邮件地址的有效性，以后可以方便地找回密码)
            <c:if test="${user_session.active == false}">
            	<a href="/user.mrqa?action=sendactivemail" onclick="return sendActiveMail(this);" style="color:red;margin:0 0 0 0px;">发送激活帐户邮件</a>
          	</c:if>
        </td>
    </tr>
   <tr>
        <td align="right">用户类型</td>
        <td>
            <table width="100%" align="center" cellpadding="0" cellspacing="1" style="border:1px dotted #ccc;">
                <tr>
                    <td width="40">&nbsp;</td>
                    <td><html:radio property="group" value="AP" name="usero"/><b>Application Programmer(AP)</b></td>
                    <td><html:radio property="group" value="SP" name="usero"/><b>System Programmer(SP)</b></td>
                    <td><html:radio property="group" value="BA" name="usero"/><b>Business Analyst(BA)</b></td>
                </tr>
                <tr>
                    <td valign="top">
                        <p>一级 0-1000</p>
                        <p>二级 1001-3000</p>
                        <p>三级 3001-6000</p>
                        <p>四级 6001-10000</p>
                        <p>五级 10001-20000</p>
                        <p>六级 20001</p>
                    </td>
                    <td valign="top">
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Application Engineer</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Senior Application Engineer</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Application Architect</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Application Manager</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Vice Presiden</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;President</p>
                    </td>
                    <td valign="top">
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;System Engineer</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Senior System Engineer</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;System Specialist</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;System Manager</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Vice President</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;President</p>
                    </td>
                    <td valign="top">
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Business Analyst</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Senior Business Analyst</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Business Consultant</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Business Manager</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Vice President</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;President</p>
                    </td>
                </tr>
            </table>
        </td>
    </tr>    
    <tr>
        <td align="right">移动电话</td>
        <td>
            <html:text property="mobile" size="12" maxlength="12" name="usero"/>(没有重复注册的【移动电话】地址可作为登录名用于登录系统)
        </td>
    </tr> 
   <tr>
        <td align="right">签名</td>
        <td>
            <html:text property="signature" size="50" maxlength="38" name="usero"/>(个性/心情)
        </td>
    </tr>
    <tr>
        <td align="right">验证码:</td>
        <td>
            <input type="text" name="vc" value="" size="4" maxlength="4">*<img src="<%=request.getContextPath()%>/vcimg" width="40" height="20" border="0" align="absbottom"/>
        </td>
    </tr>
    <tr>
        <td align="right">&nbsp;</td>
        <td>
            <input type="submit" value="保存修改"/>
        </td>
    </tr>    
    </html:form>
</table>

<script type="text/javascript">
    function validate(pForm)
    {
        var passwordQuestion = pForm.passwordQuestion.value;
        if(passwordQuestion == "")
        {
            alert("[密码提示]必须输入");
            pForm.passwordQuestion.focus();
            return false;        
        }
        var passwordAnswer = pForm.passwordAnswer.value;
        if(passwordAnswer == "")
        {
            alert("[密码答案]必须输入");
            pForm.passwordAnswer.focus();
            return false;        
        }
        var email = pForm.email.value;
        if(email == "" || email < 10)
        {
            alert("[电子邮件]必须输入");
            pForm.email.focus();
            return false;        
        }
        var reg = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/;
  			if(!reg.test(email)){
  					alert("[电子邮件]格式不正确");
            pForm.email.focus();
            return false;
  			}
        var vc = pForm.vc.value;
        if(vc == "" || vc.length < 4)
        {
            alert("[验证码]必须输入");
            pForm.vc.focus();
            return false;        
        }
        return true;
    }
    function checkLoginName(pLink)
    {
        
        if(document.user.loginName.value == "")
        {
            alert("请输入登陆名！");return false;
        }
        var link = "<%=request.getContextPath()%>/user.mrqa?action=checkloginnameifexist";
        pLink.href =link+"&loginName="+document.user.loginName.value;
        return true;
        
    }
    function checkEmailExit(pLink)
    {
    		if(document.user.email.value == "")
        {
            alert("请输入地子邮件！");return false;
        }
        var link = "<%=request.getContextPath()%>/user.mrqa?action=checkemailexist";
        link = link+"&loginName="+document.user.email.value+"&id="+document.user.id.value;
        pLink.href = link;
        return true;
    }
    
    function sendActiveMail(pLink){
    	if(document.user.email.value == "")
        {
            alert("请输入地子邮件！");return false;
        }
        var link = "<%=request.getContextPath()%>/user.mrqa?action=sendactivemail";
        link = link+"&email="+document.user.email.value+"&id="+document.user.id.value;
        pLink.href = link;
        //alert(link);
        return true;
    }
</script>